<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>股票管理</title>
<%@include file="../static/include/head.jsp"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<script src="<%=request.getContextPath()%>/static/assets/global/scripts/metronic.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/static/assets/admin/layout/scripts/layout.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/static/assets/admin/layout/scripts/quick-sidebar.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/static/assets/admin/layout/scripts/demo.js" type="text/javascript"></script>

<link href="<%=request.getContextPath()%>/static/assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<script src="<%=request.getContextPath()%>/static/assets/global/plugins/datatables/media/js/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/static/assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js" type="text/javascript"></script>

<link href="<%=request.getContextPath()%>/static/assets/global/plugins/bootstrap-datepicker/css/datepicker.css" rel="stylesheet" type="text/css" />
<script src="<%=request.getContextPath()%>/static/assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js" type="text/javascript"></script>

<script>
	jQuery(document).ready(function() {
		Metronic.init();
		Layout.init();
		QuickSidebar.init();
		Demo.init();
		$("#serchButton").click(function() {
			tableStockInit.fnDraw();
			sleep(200);
			refreshTable();
		});
		
		$('.date-picker').datepicker({
			language : 'cn',
			todayBtn : false,
			autoclose : true,
			forceParse : true,
			format : "yyyy-mm-dd"
		});
			
		var tableStockInit = $("#table_stock").dataTable({
				"paging" : true, //翻页功能
				"lengthChange" : true, //改变每页显示数据数量
				"searching" : false, //过滤功能
				"ordering" : true, //排序功能
				"order" : [ [ 0, "desc" ] ],
				"processing" : false,
				"serverSide" : true, //服务器数据
				"lengthMenu" : [ 10, 15, 30, 50 ],
				"pageLength" : 10,
				"language" : {
				"processing" : "努力加载中...",
				"search" : "搜索&nbsp;:",
				"lengthMenu" : "一页显示 _MENU_ 条数据",
				"info" : "当前第 _START_ 条到第 _END_ 条记录，共 _TOTAL_ 条记录",
				"loadingRecords" : "正在努力的加载数据...",
				"infoEmpty" : "当前第 0 条到第 0 条记录，共 0 条记录",
				"emptyTable" : "没有找到您查询的数据信息"
			},
			"ajax" : {
				"url" : "getUserStockRlPage",
				"type" : "POST",
				"data" : function(data) {
					data.stockName = $("#stockName").val();
					data.stockCode = $("#stockCode").val();	
					if(typeof($("#userName").val()) == "undefined"){
						data.userName = '${sessionScope.username}';
					}else{
						data.userName = $("#userName").val();
					}
					data.years = $("#years").val();
				}
			},
			"columns" : [{
					"data" : "id"
				},{
					"data" : "stockCode"
				},{
					"data" : "stockName"
				},{
					"data" : "storeNum"
				},{
					"data" : "status"
				},{
					"data" : "num"
				},{
					"data" : "cost"
				},{
					"data" : "earnings"
				},{
					"data" : "floatEarningsRate"
				},{
					"data" : "staticEarnings"
				},{
					"data" : "earningsRate"
				},{
					"orderable": false,
					"data" : null,
					"defaultContent" : "<div style='width:340'><button type='button' onclick='lookStockInit($(this))' class='btn blue btn-xs'>查看 <i class='fa fa-edit'></i>"+
										"<button type='button' onclick='directTrans($(this))' class='btn blue btn-xs'>查看交易记录<i class='fa fa-edit'></i>"+
										"<shiro:hasRole name='admin'></button><button type='button' onclick='deleteStockInit($(this))' class='btn red btn-xs'>删除 <i class='fa fa-times'></i></button></shiro:hasRole>"+
										"<shiro:hasRole name='admin'><button type='button' onclick='shareStockInit($(this))' class='btn red btn-xs'>分红 <i class='fa fa-edit'></i></button></shiro:hasRole>"+
										"</div>"
				}],
				 "initComplete": function(settings, json) {
					var ul = $("#table_stock_info");
					var obj = new Object();
					obj.stockName = $("#stockName").val();
					obj.stockCode = $("#stockCode").val();	
					if(typeof($("#userName").val()) == "undefined"){
						obj.userName = '${sessionScope.username}';
					}else{
						obj.userName = $("#userName").val();
					}
					obj.years = $("#years").val();
					obj.userId = ${sessionScope.id};
					$.ajax({
						type:"POST",
						url:"<%=request.getContextPath()%>/getRlData",
						data:obj,
						dataType :'json',
						timeout:"200000",
						success:function(rs,textStatus){
							var msg = rs.msg;
							var code = rs.code;
							if(code == 0 && 'succ' == msg){
								var total = rs.total;
								var rate = rs.rate
								var html = '&nbsp;&nbsp;&nbsp;&nbsp;总盈亏:'+total+'&nbsp;收益率:'+rate;
								$(ul).append(html);
							}else{
								alert(rs.data);
							}				
						},
						error : function(XMLResponse) {
							alert("提交超时请检查网络环境");
						}
					});
			    }
		});
		getRlData();
		/* $("#portlet_tab1").bind("click",function(){
			alert('2015');
			$("#portlet_tab1").append($("#dataTableDiv2"));
		}); */
	});
	
	function sleep(numberMillis) { 
		var now = new Date(); 
		var exitTime = now.getTime() + numberMillis; 
		while (true) { 
		now = new Date(); 
		if (now.getTime() > exitTime) 
			return; 
		} 
	}
	
	function refreshTable(){
		var ul = $("#table_stock_info");
		var obj = new Object();
		obj.stockName = $("#stockName").val();
		obj.stockCode = $("#stockCode").val();	
		if(typeof($("#userName").val()) == "undefined"){
			obj.userName = '${sessionScope.username}';
		}else{
			obj.userName = $("#userName").val();
		}
		obj.years = $("#years").val();
		obj.userId = ${sessionScope.id};
		$.ajax({
			type:"POST",
			url:"<%=request.getContextPath()%>/getRlData",
			data:obj,
			dataType :'json',
			timeout:"200000",
			success:function(rs,textStatus){
				var msg = rs.msg;
				var code = rs.code;
				if(code == 0 && 'succ' == msg){
					var total = rs.total;
					var rate = rs.rate
					var html = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;总盈亏:'+total+'&nbsp;收益率:'+rate;
					$(ul).append(html);
				}else{
					alert(rs.data);
				}				
			},
			error : function(XMLResponse) {
				alert("提交超时请检查网络环境");
			}
		});
		getRlData();
	}
	
	//跳转到交易记录
	function directTrans(item){
	 	var tableRow = item.parents('tr')[0];
	    var idTh = $(tableRow).children().get(0);
	    
	    window.location.href = '<%=request.getContextPath()%>/stockTranscationManage?userStockRlId='+$(idTh).text()+'&userName='+$("#userName").val();
	}
	
 	// 查看按钮初始化
	function lookStockInit(item) {
		clearInput();
		$("#edit_stock_btn").show();
	    $("#submit_stock_btn").hide();
	    $("#stockInfoTable input[type='text']").each(function(e){
	    	$(this).attr("readonly","readonly");
	    	$(this).attr("style","border:0px");
	    	$(this).css("background-color",$(this).parents('td').css('background-color'));
		 });
	    $("#stockInfoTable textarea").each(function(e){
	    	$(this).attr("readonly","readonly");
	    	$(this).attr("style","border:0px");
	    	$(this).css("background-color",$(this).parents('td').css('background-color'));
		 });
	    $("#stockInfoTable select").each(function(e){
	    	$(this).attr("readonly","readonly");
	    	$(this).attr("style","border:0px");
	    	$(this).css("background-color",$(this).parents('td').css('background-color'));
		});
	    
		$("#managerStock_title").text("查看股票持有详情");
		$("#managerStock_color").attr("class","portlet box blue");
        var tableRow = item.parents('tr')[0];
        var idTh = $(tableRow).children().get(0);
        $.post("<%=request.getContextPath()%>/getUserStockRlById", 
    		{ 
    			id: $(idTh).text()
    		}, 
    		function(json){
    			for(var index in json.data){
    				var val = json.data[index];
    				if(typeof($("#stock_"+index+"_edit")) != "undefined"){
    					$("#stock_"+index+"_edit").val(json.data[index]);
    					<!-- 下拉框处理 -->
						if(index=='ammeterBeiLv'){
							$("#stock_"+index+"_edit").val(json.data[index]);						
						}
    				}
    			}
    			
				$("#managerStock_div").modal("show");
			},"json"
    	);
    };
	
    //新增按钮初始化
    function addStockInit() {
		clearInput();
		$("#edit_stock_btn").hide();
	    $("#submit_stock_btn").show();
	    $("#stockInfoTable input[type='text']").each(function(e){
	    	$(this).removeAttr("readonly");
	    	$(this).removeAttr("style");
	    	$(this).css("background-color","");
		 });
	    
	    $("#stockInfoTable textarea").each(function(e){
	    	$(this).removeAttr("readonly");
	    	$(this).removeAttr("style");
	    	$(this).css("background-color","");
		 });
	    $("#stockInfoTable select").each(function(e){
	    	$(this).removeAttr("readonly");
	    	$(this).removeAttr("style");
	    	$(this).css("background-color","");
		 });
	    
		$("#managerStock_div").modal("show");
		$("#managerStock_title").text("修改账户股票关系资料");
		$("#managerStock_color").attr("class","portlet box yellow");		
    };
    
    
	// 修改按钮初始化
	function editStockInit() {
		$("#edit_stock_btn").hide();
	    $("#submit_stock_btn").show();
	    $("#stockInfoTable input[type='text']").each(function(e){
	    	$(this).removeAttr("readonly");
	    	$(this).removeAttr("style");
	    	$(this).css("background-color","");
		 });
	    $("#stockInfoTable textarea").each(function(e){
	    	$(this).removeAttr("readonly");
	    	$(this).removeAttr("style");
	    	$(this).css("background-color","");
		 });
	    $("#stockInfoTable select").each(function(e){
	    	$(this).removeAttr("readonly");
	    	$(this).removeAttr("style");
	    	$(this).css("background-color","");
		 });
		$("#managerStock_title").text("修改账户股票关系资料");
		$("#managerStock_color").attr("class","portlet box yellow");
    };
    
 	// 删除按钮初始化
	function deleteStockInit(item) {
		$("#stock_id_delete").val("");
        var tableRow = item.parents('tr')[0];
        var idTh = $(tableRow).children().get(0);
        var stationNameTh = $(tableRow).children().get(4);
        var stationNewNumberTh = $(tableRow).children().get(1);
        var id = $(idTh).text();
        $("#stock_id_delete").val(id);
        var message = "您确定要删除编号:"+id+",的账户股票条目吗?(本操作不可恢复)"
        $("#deleteStock_p").text(message);
        $("#deleteStock_div").modal("show");
    };
	
	
	//简单校验用户输入
	function submit_validation(){
		var obj = new Object();
		$("#stockInfoTable input[type='text']").each(function(e){
			var stationId = $(this).attr("id");
		    var idArray = stationId.split('_');
		    obj[idArray[1]] = $(this).val();
		 });
		var id = $("#stock_id_edit").val();
		
		$("#stockInfoTable select").each(function(e){
		    var inputId = $(this).attr("id");
		    var idArray = inputId.split('_');
		    if($(this).val()!=''){
			    obj[idArray[1]] = $(this).val();
		    }
		});
		
		$("#stockInfoTable textarea").each(function(e){
		    var inputId = $(this).attr("id");
		    var idArray = inputId.split('_');
		    if($(this).val()!=''){
			    obj[idArray[1]] = $(this).val();
		    }
		});
		
		if(id == ''){
			save_stock(obj)
		}else{
			update_stock(obj)
		}
		clearInput();
	}
	
	// 更新基站提交
	function update_stock(obj){
		$.post("<%=request.getContextPath()%>/updateUserStockRl",obj, 
	    	function(result){
	    		if(result == -1){
					alert("系统内部错误,请与管理员联系！");
					$("#managerStock_div").modal("hide");
					$("#table_stock").dataTable().fnDraw();
				}else if(result == 0){
					alert("修改股票成功！");
					$("#managerStock_div").modal("hide");
					$("#table_stock").dataTable().fnDraw();
				}
			}
	    );
	}
	
	// 增加电费提交
	function save_stock(obj){
		$.ajax({
			type:"POST",
			url:"<%=request.getContextPath()%>/addUserStockRl",
			data:obj,
			dataType :'json',
			timeout:"20000",
			success:function(data,textStatus){
				var msg = data.msg;
				var code = data.code;
				if(code == 0 && 'succ' == msg){
					alert("保存成功");
					$("#managerStock_div").modal("hide");
					$("#table_stock").dataTable().fnDraw();
				}				
			},
			error : function(XMLResponse) {
				alert("提交超时请检查网络环境");
				$("#managerStock_div").modal("hide");
				$("#table_stock").dataTable().fnDraw();
			}
		});
	}
	
	// 删除基站提交
	function delete_stock(){
		$.post("<%=request.getContextPath()%>/deleteUserStockRlById", 
	    	{ 
				id:$("#stock_id_delete").val()
	    	}, 
	    	function(result){
	    		if(result == -1){
					alert("系统内部错误,请与管理员联系！");
					$("#deleteStock_div").modal("hide");
					$("#stock_id_delete").val("");
					$("#table_stock").dataTable().fnDraw();
				}else if(result == 0){
					alert("删除账户股票成功！");
					$("#deleteStock_div").modal("hide");
					$("#stock_id_delete").val("");
					$("#table_stock").dataTable().fnDraw();
				}
			}
	    );
	}
	
	//分红按钮初始化
    function shareStockInit(item){
    	$("#stock_id_share").val("");
        var tableRow = item.parents('tr')[0];
        var idTh = $(tableRow).children().get(0);
        var id = $(idTh).text();
        $("#stock_id_share").val(id);
        $("#shareStock_div").modal("show");
    }
	
    //分红提交
    function shareStock(){
    	var obj = new Object();
    	$("#stockShareTable input[type='text']").each(function(e){
			var stationId = $(this).attr("id");
		    var idArray = stationId.split('_');
		    obj[idArray[1]] = $(this).val();
		});
    	$.post("<%=request.getContextPath()%>/addUserRlShare",obj, 
 	    	function(result){
 	    		if(result == -1){
 					alert("系统内部错误,请与管理员联系！");
 					$("#shareStock_div").modal("hide");
 					$("#stockShareTable").dataTable().fnDraw();
 				}else if(result == 0){
 					alert("分红保存成功！");
 					$("#shareStock_div").modal("hide");
 					$("#stockShareTable").dataTable().fnDraw();
 				}
 			}
   	    );
    	clearInput();
    }
	
	function clearInput(){
		$("#stockInfoTable input[type='text']").each(function(e){
			$(this).val("");
		 });
	}
	
	function toUpload(){
		window.location.href = "<%=request.getContextPath()%>/toUploadStock";
	}
	
	function getRlData(){
		var ul = $("#dataInfo");
		$(ul).html("");
		var obj = new Object();
		obj.stockName = $("#stockName").val();
		obj.stockCode = $("#stockCode").val();	
		if(typeof($("#userName").val()) == "undefined"){
			obj.userName = '${sessionScope.username}';
		}else{
			obj.userName = $("#userName").val();
		}
		obj.years = $("#years").val();
		obj.userId = ${sessionScope.id};
		$.ajax({
			type:"POST",
			url:"<%=request.getContextPath()%>/getRlData",
			data:obj,
			dataType :'json',
			timeout:"200000",
			success:function(rs,textStatus){
				var msg = rs.msg;
				var code = rs.code;
				if(code == 0 && 'succ' == msg){
					var total = rs.total;
					var rate = rs.rate
					var html = '&nbsp;&nbsp;&nbsp;&nbsp;总盈亏:'+total+'&nbsp;收益率:'+rate;
					$(ul).append(html);
				}else{
					alert(rs.data);
				}				
			},
			error : function(XMLResponse) {
				alert("提交超时请检查网络环境");
			}
		});
	}
</script>
</head>
<body class="page-header-fixed page-quick-sidebar-over-content">
	<%@include file="../static/include/header.jsp"%>
	<div class="clearfix"></div>
	<div class="page-container">
		<%@include file="../static/include/sidebar.jsp"%>
		<!-- BEGIN CONTENT -->
		<div class="page-content-wrapper">
			<div class="page-content">
				<!-- BEGIN STYLE CUSTOMIZER -->
				<%@include file="../static/include/styles.jsp"%>
				<!-- END STYLE CUSTOMIZER -->
				<div class="row">
					<div class="col-md-12">
						<!-- BEGIN PAGE HEADER-->
						<h3 class="page-title">
							股票管理 <small>股票持有条目一览</small>
						</h3>
						<div class="page-bar">
							<ul class="page-breadcrumb">
								<li><i class="fa fa-home"></i> <a href="index">主页</a> <i class="fa fa-angle-right"></i></li>
								<li><a href="stockManager">股票管理</a></li>
							</ul>
						</div>
						<!-- END PAGE HEADER-->
						<!-- BEGIN ROW -->
						<div class="portlet box blue-madison">
							<div class="portlet-title">
								<div class="caption">
									<i class="fa fa-user"></i>股票持有条目
								</div>
								<div class="tools">
									<a href="javascript:;" class="collapse"></a>
								</div>
							</div>
							<div class="portlet-body" >
								<div id="dataTableDiv">
									<ul class="nav nav-tabs">
										<shiro:hasRole name="admin">
											<li style="float: left">
												<button type="button" onclick="addStockInit()" class="btn green">
													新增 <i class="fa fa-plus"></i>
												</button>
											</li>
											<li style="float: left">
												&nbsp;
												<button type="button" class="btn green" onclick="toUpload()">
													上传 <i class="fa fa-plus"></i> 
												</button>
											</li> 
										</shiro:hasRole>
										<li style="float: left; margin-left: 5px" id="dataInfo">
											
										</li>
										<li style="float: right; margin-left: 5px">
											<button id="serchButton" type="button" class="btn green">搜索</button>
										</li>
										<li style="float: right; margin-left: 5px"><input id="stockCode" type="text" class="form-control" placeholder="请输入股票编码"></li>
										<li style="float: right"><input id="stockName" type="text" class="form-control" placeholder="请输入股票名称"></li>
										<shiro:hasRole name="admin">
											<li style="float: right"><input id="userName" type="text" class="form-control" value="${sessionScope.username}"/></li>
										</shiro:hasRole>
										<li style="float: right">
											<select class="form-control" id="years">
												<option value="" selected="selected">请选择</option>  
												<option value="2015">2015</option>
												<option value="2016">2016</option>
												<option value="2017">2017</option>
												<option value="2018">2018</option>
												<option value="2019">2019</option>
											</select>
										</li>
										<!-- <li style="float: right"><input id="years" type="text" class="form-control" placeholder="请输入股票年份"></li> -->
									</ul>
									<div class="tab-pane fade active in" id="tab_1_1">
										<table id="table_stock" class="table table-striped table-hover table-bordered">
											<thead>
												<tr>
													<th>编号</th>
													<th>编码</th>
													<th>名称</th>
													<th>编码</th>
													<th>状态</th>
													<th>数量</th>
													<th>成本</th>
													<th>浮动盈亏</th>
													<th>浮动收益率</th>
													<th>累计盈亏</th>
													<th>累计收益率</th>
													<th>操作</th>
												</tr>
											</thead>
											<tbody>
											</tbody>
											<tfoot>
						                    </tfoot>
										</table>
									</div>
								</div>
							</div>
						</div>
						<!-- END ROW -->
					</div>
				</div>
				<!-- <div class="row">
					<div class="col-md-12">
					BEGIN TAB PORTLET
						<div class="portlet box blue">
							<div class="portlet-title">
								<div class="caption">
									<i class="fa fa-gift"></i>股票交易
								</div>
								<ul class="nav nav-tabs">
									<li class="active" id="portlet_tab1">
										<a href="#portlet_tab1" data-toggle="tab">
										2015 </a>
									</li>
									<li>
										<a href="#portlet_tab2" data-toggle="tab">
										2016 </a>
									</li>
									<li>
										<a href="#portlet_tab3" data-toggle="tab">
										2017 </a>
									</li>
								</ul>
							</div>
							<div class="portlet-body">
								<div class="tab-content">
									<div class="tab-pane active" id="portlet_tab1">
										<ul class="nav nav-tabs">
										<li style="float: left">
											<button type="button" onclick="addStockInit()" class="btn green">
												新增 <i class="fa fa-plus"></i>
											</button>
										</li>
										<li style="float: left">
											&nbsp;
											<button type="button" class="btn green" onclick="toUpload()">
												上传 <i class="fa fa-plus"></i> 
											</button>
										</li> 
										<li style="float: right; margin-left: 5px">
											<button id="serchButton" type="button" class="btn green">搜索</button>
										</li>
										<li style="float: right; margin-left: 5px"><input id="stockCode" type="text" class="form-control" placeholder="请输入股票编码"></li>
										<li style="float: right"><input id="stockName" type="text" class="form-control" placeholder="请输入股票名称"></li>
										<li style="float: right"><input id="userName" type="text" class="form-control" placeholder="请输入账户名称"></li>
										<li style="float: right"><input id="years" type="text" class="form-control" placeholder="请输入股票年份"></li>
									</ul>
									<div class="tab-pane fade active in" id="tab_1_1">
										<table id="table_stock" class="table table-striped table-hover table-bordered">
											<thead>
												<tr>
													<th>编号</th>
													<th>编码</th>
													<th>名称</th>
													<th>编码</th>
													<th>状态</th>
													<th>数量</th>
													<th>成本</th>
													<th>浮动盈亏</th>
													<th>操作</th>
												</tr>
											</thead>
											<tbody>
											</tbody>
										</table>
									</div>
									</div>
									<div class="tab-pane" id="portlet_tab2">
										<p>
											 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo.
										</p>
									</div>
									<div class="tab-pane" id="portlet_tab3">
										<p>
											 Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
										</p>
									</div>
								</div>
							</div>
						</div>
						END TAB PORTLET
					</div> -->
				</div>
			</div>
			<!-- END CONTENT -->
		</div>
	</div>
	<%@include file="../static/include/footer.jsp"%>
	<!-- modal BEGIN -->
	<div id="managerStock_div" class="modal fade" tabindex="-1" aria-hidden="true">
		<div class="modal-dialog">
			<div id="managerStock_color" class="portlet box blue" style="width: 900px">
				<div class="portlet-title">
					<div class="caption">
						<i class="fa fa-user"></i>股票管理
					</div>
					<div id="managerBill_title" class="tools"></div>
				</div>
				<div class="portlet-body form">
					<div class="form-body">
						<table style="margin: 3px" class="table table-striped table-hover table-bordered" id="stockInfoTable">
							<tr hidden="true">
								<td>编号</td>
								<td><input class="col-md-12" id="stock_id_edit" type="text" readonly="readonly"></input></td>
								<td></td>
								<td></td>
							</tr>
							<tr>
								<td>股票名称</td>
								<td><input class="col-md-12" id="stock_stockName_edit" type="text"></input></td>
								<td>股票编码</td>
								<td><input class="col-md-12" id="stock_stockCode_edit" name="stock_stockCode_edit" type="text"></input></td>
							</tr>
							<tr>
								<td>账户名称</td>
								<td><input class="col-md-12" id="stock_userName_edit" type="text"></input></td>
								<td>年份</td>
								<td>
									<!-- <input class="col-md-12" id="stock_year_edit" type="text"/> -->
									<select class="form-control" id="stock_years_edit">
										<option value="" selected="selected">请选择</option>  
										<option value="2015">2015</option>
										<option value="2016">2016</option>
										<option value="2017">2017</option>
										<option value="2018">2018</option>
										<option value="2019">2019</option>
									</select>
								</td>
							</tr>
							<tr>
								<td>状态</td>
								<td>
									<!-- <input id="stock_status_edit" name="stock_status_edit"  type="text"/> -->
									<select class="form-control" id="stock_status_edit">
										<option value="" selected="selected">请选择</option>  
										<option value="建仓">建仓</option>
										<option value="首补">首补</option>
										<option value="二次补仓">二次补仓</option>
										<option value="已卖出">已卖出</option>
										<option value="其他">其他</option>
									</select>
								</td>
								<td>股票数量</td>
								<td><input class="col-md-12" id="stock_num_edit" type="text"></input></td>
							</tr>	
							<tr>
								<td>成本</td>
								<td><input class="col-md-12" id="stock_cost_edit" type="text" readonly="readonly"></input></td>
								<td>持仓编码</td>
								<td><input class="col-md-12" id="stock_storeNum_edit" type="text" readonly="readonly"></input></td>
							</tr>												
							<tr>
								<td>备注</td>
								<!-- <td colspan="3"><input class="col-md-12" id="stock_remark_edit" type="text"></input></td> -->
								<td colspan="3" ><textarea rows="3" cols="20" class="col-md-12" id="stock_description_edit"></textarea></td>
							</tr>
						</table>
					</div>
					<div class="form-actions right">
						<button type="button" data-dismiss="modal" class="btn default">返回</button>
						<shiro:hasRole name="admin">
							<button id="edit_stock_btn" type="button" onclick="editStockInit()" class="btn yellow" hidden="true">修改</button>
							<button id="submit_stock_btn" type="button" onclick="submit_validation()" class="btn green">提交</button>
						</shiro:hasRole>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- modal END -->

	<!-- modal BEGIN -->
	<div id="deleteStock_div" class="modal fade" tabindex="-1" aria-hidden="true">
		<div class="modal-dialog">
			<div class="portlet box red">
				<div class="portlet-title">
					<div class="caption">
						<i class="fa fa-user"></i>股票管理
					</div>
					<div class="tools">删除账户股票</div>
				</div>
				<div class="portlet-body form">
					<div class="form-body">
						<input class="col-md-10" id="stock_id_delete" type="text" readonly="readonly" hidden="true"></input>
						<p id="deleteStock_p"></p>
					</div>
					<div class="form-actions right">
						<button type="button" data-dismiss="modal" class="btn default">返回</button>
						<button type="button" onclick="delete_stock()" class="btn red">删除</button>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- modal END -->
	
	<div id="dataTableDiv2">
	</div>
	
	<!-- modal BEGIN -->
	<div id="shareStock_div" class="modal fade" tabindex="-1" aria-hidden="true">
		<div class="modal-dialog">
			<div class="portlet box red">
				<div class="portlet-title">
					<div class="caption">
						<i class="fa fa-user"></i>股票管理
					</div>
					<div class="tools">股票分红</div>
				</div>
				<div class="portlet-body form">
					<div class="form-body">
						<table style="margin: 3px" class="table table-striped table-hover table-bordered" id="stockShareTable">
							<tr hidden="true">
								<td>编号</td>
								<td><input class="col-md-10" id="stock_id_share" type="text" readonly="readonly" hidden="true"/></td>
								<td></td>
								<td></td>
							</tr>
							<tr>
								<td>每多少股</td>
								<td><input class="col-md-12" id="stock_baseStockNum_share" type="text"></input></td>
								<td>分多少股</td>
								<td><input class="col-md-12" id="stock_shareStockNum_share" type="text"></input></td>
							</tr>
							<tr>
								<td>每多少股</td>
								<td><input class="col-md-12" id="stock_baseCashNum_share" type="text"></input></td>
								<td>分多少元</td>
								<td><input class="col-md-12" id="stock_shareCash_share" type="text"></input></td>
							</tr>
						</table>
					</div>
					<div class="form-actions right">
						<button type="button" data-dismiss="modal" class="btn default">返回</button>
						<button type="button" onclick="shareStock()" class="btn red">保存</button>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- modal END -->
</body>
</html>
